<template>
  <!-- <link rel="stylesheet" href="//at.alicdn.com/t/font_3124033_2sep3wtjzko.css"> -->
  <div class="contentBody">
    <div class="title">
        <div class="header">
        <i class="el-icon-s-home"></i>
        <span style="color:#e9a539">地产分类</span>
      </div>
    </div>
    <div
      class="categoryCard"
      v-for="item in categoryList"
      :key="item.id"
      @click="toProperty"
    >
      <div class="left">
        <img :src="item.image" alt="" />
      </div>
      <div class="line"></div>
      <div class="right">
        <h2>{{ item.title }}</h2>
        <p>{{ item.desc }}</p>
      </div>
    </div>
  </div>
</template>
<script>
import { getCategoryList } from "@/api/categories";

export default {
  async created() {
    const { data } = await getCategoryList(this.params);
    this.categoryList = data;
  },
  data() {
    return {
      params: { _limit: 100, _start: 0 },
      categoryList: {},
    };
  },
  methods: {
    toProperty() {
      this.$router.push({
        path: "/property",
      });
    },
  },
};
</script>
<style lang="less" scoped>
.title {
  width: 50%;
  text-align: left;
  margin: 0 auto;
  color: rgb(233, 165, 57);
}
.header {
    margin: 1vw 0;
    font-weight: bold;
    span {
      
      font-size: 1.5vw;
    }
    }
    .el-icon-s-home {
      color:#e9a539 ;
      font-size: 1.5vw;
      margin-right: 0.26vw;
    }

.contentBody {
  margin-bottom: 10.417vw;
}
.categoryCard {
  display: flex;
  width: 50%;
  height: 10.417vw;
  // background-color: skyblue;
  border: 0.052vw solid #ccc;
  margin: 0 auto;
  margin-bottom: 1.042vw;
  box-shadow: 0 0 0 0 #000;
  background-color: rgba(255, 255, 255, 0.418);
  //   border-radius: 0.26vw;

  transition: 0.3s;
  &:hover {
    box-shadow: 0.104vw 0.156vw 0.208vw 0.156vw #08c1e949;
    // border-radius: 0.26vw;
  }

  .line {
    display: block;
    content: "";
    height: 90%;
    border-right: 0.052vw solid #ccc;
    margin-top: 0.521vw;
  }
  .left {
    height: 100%;
    width: 30%;
    // background-color: tomato;
    img {
      display: block;
      width: 9.896vw;
      height: 9.896vw;
      margin: 0.26vw auto;
      object-fit: cover;
    }
  }
  .right {
    height: 100%;
    width: 70%;
    // background-color: red;
    text-align: center;
    padding: 0 0.521vw;
  }
}
</style>